﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Xml.Serialization;

namespace ProjectWizardManagement.Entity.Model
{
    public class ProjectFile
    {
        #region Constructor
        public ProjectFile()
        {
            ProjectFiles = new HashSet<ProjectFile>();
            Extension = string.Empty;
        }
        #endregion

        #region Properties
                    
        [Key]
        [XmlElement("Id")]
        public int Id { get; set; }

        [XmlElement("Name")]
        public string Name { get; set; }

        [XmlElement("Extension")]
        public string Extension { get; set; }

        [XmlElement("Path")]
        [NotMapped]
        public string Path { get; set; }

        [XmlIgnore]
        [NotMapped]
        public bool IsDirectory { get; set; }

        [XmlIgnore]
        [NotMapped]
        public string FileName 
        {
            get { return string.Format("{0}{1}", Name, Extension); }   
        }

        [XmlElement("CurrentVersion")]
        public int CurrentVersion { get; set; }

        [XmlIgnore]
        public byte[] Data { get; set; }

        [XmlElement("DateOfUpdate")]
        [NotMapped]
        public DateTime DateOfUpdate { get; set; }

        [XmlIgnore]
        public virtual ICollection<ProjectFile> ProjectFiles { get; set; } 
        #endregion
    }
}
